package com.springboot.cropsboot.controller;


import com.springboot.cropsboot.entity.Dikuai;
import com.springboot.cropsboot.entity.Pici;
import com.springboot.cropsboot.qpage.QPage;
import com.springboot.cropsboot.service.IDikuaiService;
import com.springboot.cropsboot.service.IPiciService;
import com.springboot.cropsboot.util.ResultView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author admin
 * @since 2023-12-02
 */
@RestController
@RequestMapping("/api/admin/dikuai")
public class DikuaiController {

    @Autowired
    private IDikuaiService iDikuaiService;


    /**
     * 列表分页
     * @param obj
     * @return
     */
    @GetMapping("/getPageList")
    public ResultView getPageList(QPage qPage, Dikuai obj) {
        return this.iDikuaiService.getPageList(qPage,obj);
    }


    /**
     * 新增
     * @param obj
     * @return
     */
    @PostMapping("/saveObj")
    public ResultView saveObj(Dikuai obj) {
        return this.iDikuaiService.saveObj(obj);
    }

    /**
     * 获取当前ID信息
     * @param obj
     * @return
     */
    @GetMapping("/getId")
    public ResultView getAgentId(Dikuai obj) {
        Dikuai dikuai=this.iDikuaiService.getById(obj.getId());
        return ResultView.ok(dikuai);
    }

    /**
     * 修改
     * @param obj
     * @return
     */
    @PostMapping("/updateObj")
    public ResultView updateObj(Dikuai obj) {
        return this.iDikuaiService.updateObj(obj);
    }


    /**
     * 删除
     * @param obj
     * @return
     */
    @PostMapping("/deleteObj")
    public ResultView deleteObj(Dikuai obj) {
        return this.iDikuaiService.deleteObj(obj);
    }

}
